<template>
    <div class="springBox">
        <div class="row1">
            <div>订单编号:</div><input type="text" v-model="form.order">
        </div>
        <div class="row1">
            <div>收货人姓名:</div><input type="text" v-model="form.name">
        </div>
                <div class="row1">
            <div>收货人手机号:</div><input type="text" v-model="form.phone">
        </div>
                <div class="row1">
            <div>备注:</div><input type="text" v-model="form.paystate">
        </div>
        <div class="row2">
            <div @click="cancel" class="btn">取消</div>
            <div @click="sure" class="btn">确定</div>
        </div>
        
    </div>
</template>

<script>
    export default {
        data() {
            return {
                form:{
                    order : "",
                    name:"",
                    phone:"",
                    paystate:"",
                    time:null
                },
                bAdd:false,
            }
        },
        methods: {
            sure(){
        
              if(this.bAdd){
                this.form.time = this.currentData();
                this.$parent.dataArr.push(this.form);
              }
              this.$parent.isShow = false;
            },
            cancel(){
                this.$parent.isShow = false;
            },
            currentData(){
                const date = new Date();
                var dateString = `${date.getFullYear()}-${date.getMonth()+1}-${date.getDate()}`;
                return dateString;
            },
            initData(item,bAdd){
                this.form = item;
                this.bAdd = bAdd;
            },
        },
    }
</script>

<style scoped>
.springBox{
    left: 50%;
    top: 50%;
    margin-left: -150px;
    position: absolute;
    width: 300px;
    height: 200px;
    background:rgb(42, 95, 95);
    padding: 10px;
}
.row1{
    color: black;
    display: flex;
    flex-flow: row nowrap;
    justify-content: space-between;
    margin-bottom: 20px;
}

.row2{
    color: black;
    display: flex;
    flex-flow: row nowrap;
    justify-content: space-around;
    margin-bottom: 20px;
}

.btn{
    color: blue;
    border: blue;
}

</style>